import { getMovies } from './api.js'

Vue.component('tabbar-home', {
  template: `
    <ul>
      <li v-for="m in comingList">
        {{m.nm}}
      </li>
    </ul>
  `,

  data() {
    return {
      comingList: []
    }
  },

  async mounted() {
    fetch('http://localhost:3000/movies')
      .then(response => response.json())
      .then(result => {
        this.comingList = result.coming
      })
      
    // console.log('mounted.')
      
    // const result = await getMovies()
    // this.comingList = result.coming
  },
  
  destroyed() {
    // console.log('destroyed')
  },
})